<template>
  <div class="app-container">
    <div v-if="user">
      <el-row :gutter="20">

        <el-col :span="6" :xs="24">
          <user-card :user="user" />
        </el-col>

        <el-col :span="18" :xs="24">
          <el-card>
            <el-tabs v-model="activeTab">
              <el-tab-pane :label="$t('user.creditLogs')" name="activity">
                <activity />
              </el-tab-pane>
              <el-tab-pane :label="$t('user.resetPassword')" name="ResetPassword">
                <ResetPassword />
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-col>

      </el-row>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import UserCard from './components/UserCard'
import Activity from './components/Activity'
import ResetPassword from './components/ResetPassword'

export default {
  name: 'Profile',
  components: { UserCard, Activity, ResetPassword },
  data() {
    return {
      user: {},
      activeTab: 'activity'
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'avatar',
      'account',
      'number',
      'useNumber'
    ])
  },
  created() {
    this.getUser()
  },
  methods: {
    getUser() {
      this.user = {
        name: this.name,
        account: this.account,
        avatar: this.avatar,
        number: this.number,
        useNumber: this.useNumber
      }
    }
  }
}
</script>
